package chapter02.item03.enumtype;

// Enum singleton - the preferred approach (Page 18)

/**
 * 第三条：用私有构造器或者枚举类型强化Singleton
 */
public enum Elvis {
    INSTANCE;

    public void leaveTheBuilding() {
        System.out.println("Whoa baby, I'm outta here!");
    }

    // This code would normally appear outside the class!
    public static void main(String[] args) {
        Elvis elvis = Elvis.INSTANCE;
        elvis.leaveTheBuilding();
    }
}
